package test05.optional.demo02;

import java.util.Optional;

/**
 * @author CSY
 * @date 2025 - 04 - 07
 */
public class MainTest02 {
    public static void main(String[] args) {
        Optional<String> optional1 = Optional.ofNullable("hello");
        Optional<String> optional2 = Optional.ofNullable(null);
        //如果数据为空，则指定默认值
        String msg = optional2.orElse("早上好");
        System.out.println(msg);
    }
}
